package AcWing周赛;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a
 * Date: 2022-10-08
 * Time: 18:59
 */
public class Demo72_1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        while(T-- > 0){
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int c = (a + b) / 3;
            System.out.println(Math.min(a, Math.min(b, c)));
        }
    }
}
